package com.example.wanglong.myoneapplication.activity;

import android.annotation.SuppressLint;
import android.app.Fragment;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ListView;

import com.example.wanglong.myoneapplication.R;
import com.example.wanglong.myoneapplication.adapter.VisaOrderAdapter;
import com.example.wanglong.myoneapplication.entity.VisaOrderEntity;

import java.util.ArrayList;
import java.util.List;

@SuppressLint("NewApi")
public class MainTab03 extends Fragment
{

	private List<VisaOrderEntity> orderList=new ArrayList<VisaOrderEntity>();
	private int pagesum=0;
	private ListView orderlistView;
	private VisaOrderAdapter adapter;
	private View mOneView;


	@Override
	public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)
	{
		mOneView = inflater.inflate(R.layout.main_tab_03, container, false);

		initData(mOneView);

		return mOneView;
	}



	public void initData(View mOneView){

		orderlistView=(ListView) mOneView.findViewById(R.id.listorder);


		for(int i=0;i<20;i++){
			String title="徽州王大锤"+String.valueOf(i)+"个人旅游签证";
			String time="09-"+String.valueOf(i)+"出发";
			String price=String.valueOf(i*200);
			String orderpricetype=(i%2==0)?"已付款":"确认中";
			String ordertype=(i%2==0)?"修改订单":"取消";
			VisaOrderEntity visa=new VisaOrderEntity(i,title,time,price,ordertype,orderpricetype);
			orderList.add(visa);
		}

		adapter=new VisaOrderAdapter(getContext(),R.layout.visaorderlist_item,orderList);

		orderlistView.setAdapter(adapter);

	}

}
